package server;

import common.administration.*;
import common.itemhandling.*;
import common.itemhandling.files.*;
import common.itemhandling.files.plugins.*;
import common.specialcollections.*;

import java.io.File;
import java.util.*;
import com.db4o.Db4o;
import com.db4o.ObjectContainer;
import com.db4o.ObjectServer;
import com.db4o.ObjectSet;
import com.db4o.ext.Db4oIOException;
import com.db4o.ext.InvalidPasswordException;
import com.db4o.ext.OldFormatException;
import com.db4o.query.Predicate;


public class Test implements ServerConfiguration{
	public static void main(String[] args){
		//Lokalen Test-Server starten
		
		ObjectServer server=Db4o.openServer(HOST,PORT);
		//server.grantAccess(USER,PASS);
		
		
		try {
		    ObjectContainer client=Db4o.openClient("localhost",PORT,USER,PASS);
		    
		    final Benutzer julius = new Benutzer();
		    
		    System.out.println(julius.hashCode());
		    
		    client.store(julius);
		    
		    List <Benutzer> bs = client.query(new Predicate<Benutzer>() {
		    	public boolean match(Benutzer b) {
		            return b.equals(julius);
		        }
		    });
		    
		    System.out.println(bs.get(0).hashCode());
		    
		    // Do something with this client, or open more clients
		    client.close();
		}
		finally {
		    server.close();
		}
		
	}
	
}

